home *** CD-ROM | disk | FTP | other *** search
/ HPAVC / HPAVC CD-ROM.iso / MCASM.RAR / MC_ASM.EXE / WROX_ASM / CH12 / FONTS / PROG5_2.C < prev   
C/C++ Source or Header  |  1994-06-16  |  845b  |  41 lines

  1. /* This sample program demonstrates use of OverlapString, 
  2.  * an external procedure from Prog5_1.ASM.                
  3.  * Written by Kiselev J. CZ 1994.
  4. */
  5.  
  6. #include <dos.h>
  7.  
  8. extern "C" void OverlapString(int,int,void*,void*,int,int);
  9. char str[30] = "Hi, folks, I am a raster font!";
  10.  
  11. /* Pointer to character table */
  12. void *fontptr;
  13. int char_height;
  14.  
  15. void main(void)
  16. {
  17.  
  18. /* Video mode 12h */
  19. _AX = 0x12;
  20.  
  21. /* Call BIOS service Set Mode */
  22. geninterrupt(0x10);
  23.  
  24. asm {
  25.     push si
  26.     mov ax,0
  27.     mov es,ax
  28.     mov si,0x43*4  // Vector 43h - pointer to the current BIOS font
  29.     mov ax,es:[si]
  30.     mov word ptr fontptr[0],ax
  31.     mov ax,es:[si+2]
  32.     mov word ptr fontptr[2],ax
  33.     mov ax,0x40
  34.     mov es,ax
  35.     mov ax,es:[0x85]  // 0040:0085 - character height
  36.     mov char_height,ax
  37.     pop si
  38. }
  39. OverlapString(100,100,str,fontptr,char_height,8);
  40. }
  41.